﻿using Arquitectura.Framework.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Zeus.Comunicaciones.Logica
{
    public class AppDatabase : ISqlDatabase
    {
        #region Connection

        public override SqlProcedure FW_Dropdown(object ds_type_filter, object ds_parent)
        {
            return new SqlProcedure(this, "FW_Dropdown", "@ds_type_filter:varchar:200", ds_type_filter, "@ds_parent:varchar:200", ds_parent);
        }

        public override SqlProcedure DB_procedure_execute_list(object ds_name_procedure, params object[] _params)
        {
            return new SqlProcedure(this, ds_name_procedure.ToString(), _params);
        }
        
        public AppDatabase(string ConnectionString)
        {
            this.ConnectionString = ConnectionString;
            this.TimeoutSessionApp = 0;
            this.Trace = new SqlTrace();
        }
        
        public AppDatabase(string ConnectionString, string TimeoutSessionApp)
        {
            this.ConnectionString = ConnectionString;
            this.TimeoutSessionApp = Convert.ToInt32(TimeoutSessionApp.ToString());
            this.Trace = new SqlTrace();
        }
        
        #endregion

        public SqlProcedure App_Generic(string sSQL)
        {
            return new SqlProcedure(false, this, sSQL);
        }

        public SqlProcedure App_Generic()
        {
            return new SqlProcedure("<top></top>");
        }
    }
}
